<?php 
include ("include/include.php.inc");
html_header("Tickets");
list($status, $user) = auth_get_status();
$username=$user['username'];

echo "<div class='box'>\n"; 
echo " <div class='boxtop'><div></div></div>\n"; 
echo "  <div class='boxcontent'>\n"; 


echo "<p align=\"left\" ><h3>Open Tickets:</h3></p>";
echo "<!-- <p align=\"right\">Date: <?php print date( \'l d F\' )?></p> -->";


/*   $backlink=getenv('HTTP_REFERER');*/
   $client_ip=getenv('REMOTE_ADDR');

   $result = mysql_query( "SELECT tic_no,tic_user,DATE_FORMAT(tic_date,'%d/%m/%y') AS mtic_date,DATE_FORMAT(tic_time,'%T') AS mtic_time, tic_problem,tic_sup_name AS msup_name FROM chd_tickets WHERE tic_status='O' AND tic_user='$username'")
           or die("SELECT Error: ".mysql_error());

           $num_rows = mysql_num_rows($result);

           print "<TABLE width=\"100%\" bgcolor=\"#336699\" BORDER=\"0\" bordercolor=\"#FFFFFF\"><tr>";
           print "<th width=\"11%\" >Ticket#</th>";
		   print "<th width=\"22%\" >User</th>";
		   print "<th width=\"10%\" >Date-Time</th>";
		   print "<th width=\"38%\" >Problem</th>";
		   print "<th width=\"16%\" >Supp. Person</th>";
		   print "<th width=\"3%\"  >&nbsp;</th></tr>";

           while ($row = mysql_fetch_assoc($result)){
                 extract($row);
	         print "<tr><td bgcolor=\"#FFFFFF\" >$tic_no</th>";
                 print "<td bgcolor=\"#FFFFFF\" >$tic_user</td>";
                 print "<td bgcolor=\"#FFFFFF\" >$mtic_date-$mtic_time</td>";
                 print "<td bgcolor=\"#FFFFFF\" >$tic_problem</td>";
                 print "<td bgcolor=\"#FFFFFF\" >$msup_name</td>";
                 /*print "<td><a href=\"edit_ticket.php?cmd=edit&tic_no=$tic_no\"><IMG src=\"../images/edit.gif\"></a></td>";*/
                 print "<td bgcolor=\"#FFFFFF\" ><a href=\"del_ticket.php?cmd=del&tic_no=$tic_no&tic_sup_no=$msup_name\"><IMG src=\"css/images/del.gif\"></a></td></tr>";
                 }

                 print "</table>\n";
                 print "<br>";print "<br>";
				 

echo "  </div>\n"; 
echo " <div class='boxbottom'><div></div></div>\n"; 
echo "</div>\n"; 
echo "\n";

echo "<br>";



echo "<div class='box'>\n"; 
echo " <div class='boxtop'><div></div></div>\n"; 
echo " <div class='boxcontent'>\n"; 
//Ajax slide effect
?>
<div class="marginbottom">
		<a id="v_slideout" href="#"></a>
		<a id="v_slidein" href="#"></a>
		<a id="v_toggle" href="#">toggle</a>
		<a id="v_hide" href="#"></a>
		<a id="v_show" href="#"></a>
	</div>
	<div id="vertical_slide">
<?php
                 print "<table width=\"100%\" height=\"137\" border=\"0\" bordercolor=\"#FFFFFF\" align=\"center\"><tr>";
                 print "<th colspan=\"2\" bgcolor=\"#336699\"><span class=\"style6\">Add Ticket</span></th></tr><tr>";
                 print "<th width=\"19%\" scope=\"col\"><div align=\"left\"><span class=\"style14\">User Name:</span></div></th>";
    			 print "<th width=\"81%\" rowspan=\"2\" align=\"left\" valign=\"top\" ><form method=\"post\" action=\"add_ticket.php\">";
				 print "<p align=\"left\">";
				 echo "<input type=\"text\" name=\"muname\" size=\"50\" maxlength=\"20\" value=\"$username\" >";
				 print "<textarea name=\"mproblem\" cols=\"55\" rows=\"3\"></textarea></p><p align=\"left\"><input type=\"submit\" value=\" Add \"></p></form></th></tr>";
				 print "<tr>";
				 print "<th height=\"87\" valign=\"top\" scope=\"col\"><div align=\"left\"><span class=\"style14\">Problem:</span></div></th></tr></table>";
				 print "</form>";


echo "</div>\n";


echo "  </div>\n"; 
echo " <div class='boxbottom'><div></div></div>\n"; 
echo "</div>\n"; 
echo "\n";

  // mysql_close($db);

   html_footer();
?>